<head>
    <style>
        #dl,#dl10,#dl100{padding: .4em 1em .4em 20px;text-decoration: none;position: relative;}                
        #accordion-exam h3{height:30px; font-size: 20px; padding-left: 30px; }
    </style>
</head>
<script type="text/javascript">
    $(function(){
        $("#accordion-exam").accordion({header : "h3",autoHeight:false,collapsible:true});
        
    });
    //do when the dom is ready
    jQuery(document).ready(function($) {
        
        //loop through every button anchor element
        $('.dialog_but').each(function() {
            //create a local scope of a dialog variable to attach
            var $dialog;

            //create the dialog for the div.dialog_content standing next to the anchor element
            //we make the autoOpen false so that it can be reusable
            //also we set the modal = true to appear the dialog as a modal prompt
            $dialog = $(this).next('div.dialog_content').dialog({modal: true, autoOpen: false, width: 600});

            //now attach the open even of the dialog to the anchor element
            $(this).click(function(e) {
                //prevent the anchor element to go to the hyperlinked page
                e.preventDefault();

                //open the dialog
                $dialog.dialog('open');
            });
        });
    });
</script>

<?php
include '../../include/config.php';
$cmonth = 2;

/*
 * This is list of examinations. all in one.
 */
$rp = $_SERVER['REQUEST_URI'];
?>


<div id="accordion-exam">
    <?php
    while ($cmonth < 10) {
        ?>

        <style>
            .bb th, .bb td{
                border-bottom: 1px #000000 dotted !important;
                text-align: center;
            }
        </style>




        <h3><?= $cmonth ?>° month</h3>
        <div><p>
            <table  style="width: 100%;" class="bb" >        
                <?php
                $result = mysql_query("select * from baby_tests  where test_month=$cmonth ") or die(mysql_error());
                while ($row = mysql_fetch_array($result)) {
                    ?>
                    <tr><td style="width: 500px;"><?php echo $row['test_name']; ?></td>
                        <td>
                            <?php
                            $result1 = mysql_fetch_array(mysql_query("select status from baby_mother_tests where bid='" . $_COOKIE['bid'] . "' and test_id = '" . $row['test_id'] . "' "));
                            if ($result1[0] == 1) {
                                echo 'uploaded';
                            } else {
                                ?>

                                <!-- View Upload button                       -->
                                <a id="dl" class="dialog_but ui-state-default ui-corner-all" href="#">Upload</a>
                                <div class="dialog_content" title="<?php echo $row['test_name']; ?>" >                        
                                    <form enctype="multipart/form-data" action="../../plugins/upload_preg.php" method="POST">
                                        <input type="hidden" name="MAX_FILE_SIZE" value="100000000000" />
                                        <input type="hidden" name="bid" value="<?= $_COOKIE['bid'] ?>" />        
            <!--                                        <input type="hidden" name="path" value="../storage/pregnancy/" />-->
                                        <input type="hidden" name="rp" value="<?php echo $rp; ?>" />
                                        <input type="hidden" name="test_id" value="<?php echo $row['test_id']; ?>" />
                                        <input type="hidden" name="mdir" value="pregnancy" />
                                        <input type="file" name="uploadedfile" required />
                                        <input type="submit" value="Upload" />
                                    </form>
                                    <div class="ui-widget">
                                        <div class="ui-state-highlight ui-corner-all news_desc " style="margin-top: 20px; padding: 0 .7em; font-size: 11px;">
                                            <p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
                                                <strong>Note : </strong> Rename Your File name as shown in example to remove duplication with other files : filename_emailid (before '@').file type <br/> Ex. Rename test1.pdf & email='mee@mail.com' =>  test1_mee.pdf   </p>
                                        </div>
                                    </div>
                                </div> 
                            <?php } ?>
                        </td>
                    </tr>    
                    <?php
                } $result . close;
                $row . close;
                $cmonth++;
                ?>
            </table>
            </p></div>

    <?php } ?>

</div>

<?php
if ($_GET['s'] == y) {
    ?>
    <script>
        $(function(){
                    
            $('#dl0').dialog({
                width : 200,
                modal : true
            });

        });
    </script>
    <div id="dl0" title="Successfull">
        <p>SuccessFull</p>
    </div>
    <?php
} elseif ($_GET['s'] == n) {
    ?>
    <script>
        $(function(){
                    
            $('#dl00').dialog({
                width : 200,
                modal : true
            });

        });
    </script>
    <div id="dl00" title="Unsuccessful">
        <p>Opps...!!! Got some error :( <br/> Try Again...</p>
    </div>
<?php } ?>
